package com.yeyaomai.dksns.flowis.util;

import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;

public class StringUtil {
	
	/**
	 * 计算百分比 返回 矢量图片
	 */
	public static String controlLength(String s1, String s2)
			throws UnsupportedEncodingException {

		String resuit = "";
		if (s1 != null && !s1.equals("0") && s2 != null && !s2.equals("0")) {

			float f1 = Float.valueOf(s1);
			float f2 = Float.valueOf(s2);
			resuit = String.valueOf(new BigDecimal(f1 / f2 * 100).setScale(2, BigDecimal.ROUND_HALF_UP).toString());
			resuit = "<img src='../images/bar.gif' width='"+new BigDecimal(f1 / f2 * 200).setScale(0, BigDecimal.ROUND_UP)+"' height='10'>"+resuit;
		}
		return resuit;

	}
}
